function f_check_mdl_lock_daemonize()
{
    declare d_tools d_t_ fun_name
    fun_name="f_check_mdl_lock_daemonize"
    d_tools="${1}"
    d_t_="${2}"
    touch ${check_mdl_mark_file} || true
    [ "${d_tools}x" == "gh-ostx" ] && first_check_mdl_mark=1
    f_check_mdl_lock "${mysql_host}" "master" "${mysql_db}" "${d_t_}" "${_PPID}" "null" "${d_tools}" && return_res="${?}" || return_res="${?}"
    [ "${d_tools}x" == "gh-ostx" ] && first_check_mdl_mark=2
    if [ "${return_res}x" == "5x" ] && [ "${d_tools}x" == "gh-ostx" ]
    then
        mysql_table_role="$(awk '{if($1 >= 512000){print "L"}else if($1 >= 102400){print "M"}else if($1 >= 10240){print "S"}else{print "N"}}' <<< "${table_size}")"
        this_wait_time="${meet_mdl_wait_time["${mysql_table_role}"]}"
        _1_="遇到mdl等待,现在暂停改表 请于$((${this_wait_time}/60))min内联系dba进行处理"
        f_update_status_for_task_from_api "run_state = 1" "${_1_}" || true
        __="insert into ${t_prog_task}(order_id,user_mail,port,table_name,send_state,start_time,remarks) select ${user_order_id},
           '${g_user_mail_addr}',${mysql_port},'${mysql_db}.${d_t_}',0,'$(date -d @${script_start_time} "+%F %H:%M:%S")','${_1_}';"
        [ "${mysql_table_role}x" != "Nx" ] && { f_exe_sql_to_dbadb "${__}" "f_check_mdl_lock_daemonize" || true;}
        for ((stop_time=1;stop_time<=${this_wait_time};stop_time++))
        do #sleep this_wait_time s
            sleep 1
            [ -f "${check_mdl_mark_file}" ] && date +%s > ${check_mdl_mark_file}
            [ ! -f "${osc_run_mark_file}" ] && break
            f_update_status_for_task "${d_tools}" "${mysql_host}" "${d_t_}"
            [ "${global_osc_run_state}x" == "0x" -a ${stop_time} -gt 30 ] && break #期间如果global_osc_run_state=0表示是dba手动处理
            if [ $((${stop_time}%300)) -eq 0 ]
            then
                wait_mdl_time=$((${check_mdl_timeout}-1))
                f_update_status_for_task_from_api "run_state = 0" "改表恢复,请稍等 等待计算" || true
                f_check_mdl_lock "${mysql_host}" "master" "${mysql_db}" "${d_t_}" "${_PPID}" "null" "${d_tools}" && return_res="${?}" || return_res="${?}"
                if [ $(((${this_wait_time}-${stop_time})/60)) -ge 5 ]
                then
                    _1_="遇到mdl等待,现在暂停改表 请于$(((${this_wait_time}-${stop_time})/60))min内联系dba进行处理"
                    __="insert into ${t_prog_task}(order_id,user_mail,port,table_name,send_state,start_time,remarks) select ${user_order_id},
                        '${g_user_mail_addr}',${mysql_port},'${mysql_db}.${d_t_}',0,'$(date -d @${script_start_time} "+%F %H:%M:%S")','${_1_}';"
                    f_exe_sql_to_dbadb "${__}" "f_check_mdl_lock_daemonize" || true
                fi
                f_update_status_for_task_from_api "run_state = 1" "${_1_}" || true
            fi
        done
        unset _1_
        wait_mdl_time=0
        first_check_mdl_mark=3
        f_update_status_for_task_from_api "run_state = 0" "改表恢复,请稍等 等待计算" || true
        [ -f "${osc_run_mark_file}" ] && f_check_mdl_lock "${mysql_host}" "master" "${mysql_db}" "${d_t_}" "${_PPID}" "null" "${d_tools}" || true
    fi

    [ -f "${check_connect_file}" ] && rm -f ${check_connect_file}
    [ -f "${check_thread_file}" ] && rm -f ${check_thread_file}
    [ -f "${check_mdl_mark_file}" ] && rm -f ${check_mdl_mark_file}
    return 0
}


